package edu.yuhf.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import edu.yuhf.dao.iface.HobbyDao;
import edu.yuhf.domain.Hobby;

@Repository
public class HobbyJdbcDaoImpl implements HobbyDao {

	@Resource
	private JdbcTemplate jdbcTemplate;
	@Override
	public List<Hobby> getHobbyAll() {
		String sql="select * from hobby";
		List<Hobby> list=jdbcTemplate.query(sql, ((rs,index)->
			new Hobby(rs.getInt(1),rs.getString(2),rs.getInt(3))
				));
		return list;
	}

}
